package com.example.lib_router.degrade


import android.content.Context
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.facade.service.DegradeService
import com.example.base.RouterPath

@Route(path = RouterPath.PATH_GLOBAL_DEGRADE)
class GlobalDegradeService: DegradeService {

    private lateinit var mContext: Context


    override fun init(context: Context?) {
        if (context != null) {
            mContext = context
        }
    }

    /**
     * 跳转失败回调方法
     */
    override fun onLost(context: Context, postcard: Postcard) {
        //重置跳转路径或页面Path
        postcard.group = RouterPath.GROUP_EMPTY
        postcard.path = RouterPath.PATH_EMPTY_PAGE
        postcard.navigation()
    }
}